package main;

import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import java.io.Console;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JTextArea;

public class Principal extends JFrame {
    private JMenuBar menuBar = new JMenuBar();
    private JMenu menuFile = new JMenu();
    private JMenuItem menuFileExit = new JMenuItem();
    private JButton jButton1 = new JButton();
    private JTextArea jTextArea1 = new JTextArea();

    public Principal() {
        try {
            jbInit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        this.setJMenuBar(menuBar);
        this.getContentPane().setLayout(null);
        this.setSize(new Dimension(400, 300));
        this.setTitle("Principal");
        menuFile.setText("File");
        menuFileExit.setText("Exit");
        menuFileExit.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                fileExit_ActionPerformed(ae);
            }
        });
        jButton1.setText("Click");
        jButton1.setBounds(new Rectangle(165, 190, 75, 21));
        jButton1.setActionCommand("Click");
        jButton1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                jButton1_actionPerformed(e);
            }
        });
        jTextArea1.setBounds(new Rectangle(115, 45, 220, 70));
        jTextArea1.setDragEnabled(true);
        menuFile.add(menuFileExit);
        menuBar.add(menuFile);
        this.getContentPane().add(jTextArea1, null);
        this.getContentPane().add(jButton1, null);
    }

    void fileExit_ActionPerformed(ActionEvent e) {
        System.exit(0);
    }

    private void jButton1_actionPerformed(ActionEvent e) {
        System.out.println("Hola Mundo, Primer Aplicacion con Jdeveloper");
        System.out.println("Hola Mundo, Probando versionador");
        metodoPrueba();
    }

    private void metodoPrueba() {
        System.out.print("Prueba desde el metodo y versionamiento 2" + 5 + 14);
        
        String textoDeTextArea = "Hola Mundo, estamos en Chatum";
        jTextArea1.setText(textoDeTextArea);
        
    }
}
